package com.espirit.eap.manager;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.espirit.eap.util.StatGenericJPAService;
import com.googlecode.cswish.annotation.GenericType;
import com.googlecode.cswish.annotation.ParamScope;
import com.googlecode.cswish.model.PageElements;

@Service
public class ProofNbrRuleService {
	@Resource
	StatGenericJPAService genericService;
	
	@Resource
	ProofNbrRuleManager orderNbrRuleManager;
	
	public Object _update(@GenericType Object model,
			@ParamScope(visible=false, value="#ps")PageElements ps) {
//		OrderNbrRule orderNbrRule = (OrderNbrRule)genericService.load(model);
		ps.setElementReadOnly("model.name", true);
		ps.setElementRequired("model.digit", true);
		ps.setElementRequired("model.prefix", true);
		return genericService.view(model);
	}
	
	public void update(@GenericType Object model){
		ProofNbrRule orderNbrRule = (ProofNbrRule) genericService.update(model);
		orderNbrRuleManager.onChanged(orderNbrRule);
	}

}
